<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <input type="text" class="username" placeholder="请输入用户名">
    </div>
    <div>
        <input type="password" class="password" placeholder="请输入密码">
    </div>
    <button>登录</button>
    <script src="./assets/js/jquery-3.7.1.min.js"></script>
    <script>
        // 1.控制台输出用户名和密码
        console.log($('.username').val());
        console.log($('.password').val());
        // 任务：点击按钮输出用户名和密码
        // 给按钮绑定原生的点击事件（获取元素+绑定事件）
        // 获取元素
        // let bth = document.querySelector('button')
        // let username = document.querySelector('.username')
        // let password = document.querySelector('.password')



        btn.onclich = function () {
            console.log(username.value);
            console.log(password.value);
        }

        btn.addEventListenter('click', function () {
            console.log(username.value);
            console.log(password.value);
        })

        $('button').click(function(){
            console.log($('.username').val());
            console.log($('.password').val());
        })
    </script>
</body>

</html>